//
//  InputBillModel.swift
//  KaMengApplication
//
//  Created by DUONIU_MAC on 2018/11/5.
//  Copyright © 2018年 DUONIU_MAC. All rights reserved.
//

import UIKit

class InputBillModel: BillModel,NSCoding {
    
    var number : String? //卡号
    var bank : String? //银行
    var name : String? //姓名
    var billDate : String? //账单日
    var repaymentDate: String? //还款日
    var cardLines : String? //信用卡额度
    var billLines : String? //账单额度
    var date : String?  //日期
    var isPay = "0" //是否还清
    
    override init() {
        super.init()
    }
    
    func encode(with aCoder: NSCoder) {
        
        aCoder.encode(self.number, forKey: "number")
        aCoder.encode(self.bank, forKey: "bank")
        aCoder.encode(self.name, forKey: "name")
        aCoder.encode(self.billDate, forKey: "billDate")
        aCoder.encode(self.repaymentDate, forKey: "repaymentDate")
        aCoder.encode(self.cardLines, forKey: "cardLines")
        aCoder.encode(self.billLines, forKey: "billLines")
        aCoder.encode(self.date, forKey: "date")
        aCoder.encode(self.isPay, forKey: "isPay")
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init()
        
        self.number = aDecoder.decodeObject(forKey: "number") as? String
        self.bank = aDecoder.decodeObject(forKey: "bank") as? String
        self.name = aDecoder.decodeObject(forKey: "name") as? String
        self.billDate = aDecoder.decodeObject(forKey: "billDate") as? String
        self.repaymentDate = aDecoder.decodeObject(forKey: "repaymentDate") as? String
        self.cardLines = aDecoder.decodeObject(forKey: "cardLines") as? String
        self.billLines = aDecoder.decodeObject(forKey: "billLines") as? String
        self.date = aDecoder.decodeObject(forKey: "date") as? String
        self.date = aDecoder.decodeObject(forKey: "date") as? String
        self.isPay = (aDecoder.decodeObject(forKey: "isPay") as? String) ?? "0"
    }
}


